@{block #content}
<script src="http://static.opentok.com/v0.91/js/TB.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    var sessionId = {$sessionId};
    var token = {$token};
    
    var session = TB.initSession(sessionId); // Replace with your own session ID. See http://www.tokbox.com/opentok/api/tools/generator
			
    session.addEventListener("sessionConnected", sessionConnectedHandler);
    session.addEventListener("streamCreated", streamCreatedHandler);
    session.addEventListener("streamDestroyed", streamDestroyedHandler);

    session.connect('16832561', token); // Replace with your API key and token. See http://www.tokbox.com/

    function sessionConnectedHandler(event) {
        subscribeToStreams(event.streams);
        session.publish();
    }
			
    function streamCreatedHandler(event) {
        subscribeToStreams(event.streams);
    }

    function streamDestroyedHandler(event) {
        session.disconnect();
        alert({_"The call has been hang up."});
    }
			
    function subscribeToStreams(streams) {
        for (i = 0; i < streams.length; i++) {
            var stream = streams[i];
            if (stream.connection.connectionId != session.connection.connectionId) {
                session.subscribe(stream);
            }
        }
    }
</script>
<h1>
    Video Talker with no Celebrio
    <span id="message"></span>
</h1>